import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import '../common/styles.dart';

class MainButton extends StatelessWidget {
  Function()? onTap;
  Widget? icon;
  String text;
  double? textSize;
  EdgeInsetsGeometry? padding;

  MainButton({
    super.key,
    this.onTap,
    required this.text,
    this.icon,
    this.padding,
    this.textSize,
  });

  @override
  Widget build(BuildContext context) {
    return CupertinoButton(
      onPressed: () => onTap?.call(),
      padding: EdgeInsets.zero,
      child: Container(
        padding:
            padding ?? const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
        decoration: BoxDecoration(
          color: Colors.blue.withOpacity(0.2),
          // gradient: LinearGradient(
          //   colors: [Colors.blue.withOpacity(1), Colors.orange.withOpacity(1)],
          // ),
          borderRadius: const BorderRadius.all(Radius.circular(50)),
        ),
        child: Row(
          mainAxisSize: MainAxisSize.min,
          children: [
            icon ?? Container(),
            Text(
              text,
              style: Styles.textStyle(size: textSize ?? 20, height: 1.2),
            ),
          ],
        ),
      ),
    );
  }
}
